package com.itheima.mall.dubbo.api.pms;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mall.dubbo.mapper.pms.PmsSkuStockMapper;
import com.itheima.mall.entity.domain.pms.SkuStock;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsSkuStockServiceImpl extends ServiceImpl<PmsSkuStockMapper, SkuStock> implements PmsSkuStockService {
    @Autowired
    private PmsSkuStockMapper skuStockMapper;
    @Override
    public List<SkuStock> getList(Integer pid, String keyword) {
        LambdaQueryWrapper<SkuStock> lqw = new LambdaQueryWrapper<>();
        lqw.eq(SkuStock::getId,pid);
        lqw.like(keyword != null,SkuStock::getSkuCode,keyword);
        List<SkuStock> skuStocks = skuStockMapper.selectList(lqw);
        return skuStocks;
    }
}
